
	int stackIndex = COUNTRY_INFO.TOTAL_COUNTRIES - 1;
	int pickedCard = -1;
	boolean showCard = false;

	public void UpdatePickCard()
	{
		tegCountries[cardStack[stackIndex]].cardOwner = cPlayer.turn;
		showCard = true;
		pickedCard = cardStack[stackIndex];
		stackIndex--;
		canPickCard = false;
		hasPickedCard = true;
		
		if(stackIndex == -1)
		{
			int availableCards = 0;
		
			int card = 0;
			boolean cardInStack;
			
			for(int j = 0; j < COUNTRY_INFO.TOTAL_COUNTRIES; j++)
			{
				if(tegCountries[j].cardOwner == -1)
					availableCards++;
			}
			
			cardStack = new int[availableCards];
		
			for(int i = 0; i < availableCards; i++)
			{			
				do
				{
					cardInStack = false;
				
					do
					{
						card = random.nextInt() % COUNTRY_INFO.TOTAL_COUNTRIES;
					}
					while(card < 0);
					
					if(i > 0)
					{
						for(int j = i - 1; j >= 0; j--)
						{
							if(card == cardStack[j])
							{
								cardInStack = true;
								break;
							}
						}
					}
				}
				while(cardInStack || tegCountries[card].cardOwner != -1);
				
				cardStack[i] = card;
			}
			
			stackIndex = availableCards - 1;
		}
	}
	
	public void drawCard(int card)
	{
		#ifdef USE_DRAWRGB
		cGame_g.setColor(MENUS.MAIN_MENU_BACKGROUND_COLOR);
		cGame_g.drawAlphaRect(SCREEN_WIDTH / 2 - CARDS.CARD_WIDTH, SCREEN_HEIGHT / 2 - CARDS.CARD_HEIGHT, CARDS.CARD_WIDTH * 2, CARDS.CARD_HEIGHT * 2, MENUS.MAIN_MENU_ALPHA_LEVEL);
		#else
		cGame_g.setColor(MENUS.MAIN_MENU_BACKGROUND_COLOR);
		cGame_g.fillRect(SCREEN_WIDTH / 2 - CARDS.CARD_WIDTH, SCREEN_HEIGHT / 2 - CARDS.CARD_HEIGHT, CARDS.CARD_WIDTH * 2, CARDS.CARD_HEIGHT * 2);		
		cGame_g.setColor(MENUS.MAIN_MENU_FOREGROUND_COLOR);
		cGame_g.drawRect(SCREEN_WIDTH / 2 - CARDS.CARD_WIDTH, SCREEN_HEIGHT / 2 - CARDS.CARD_HEIGHT, CARDS.CARD_WIDTH * 2, CARDS.CARD_HEIGHT * 2);		
		#endif
		cGame_g.setFontColor(MENUS.MAIN_MENU_FOREGROUND_COLOR);
		cGame_g.setFont(DGraph.FONT_SMALL);
		cGame_g.drawString(TEXT.INGAME_PICKED_CARD, SCREEN_WIDTH / 2 - cGame_g.getFontWidth() / 2, SCREEN_HEIGHT / 2 - CARDS.CARD_HEIGHT + cGame_g.getFontHeight(), CARDS.CARD_WIDTH * 2 - cGame_g.getFontWidth() * 2, DSmallFont.HCENTER | DSmallFont.TOP);
		cGame_g.setColor(MENUS.MAIN_MENU_FOREGROUND_COLOR);
		cGame_g.drawRect(SCREEN_WIDTH / 2 - CARDS.CARD_WIDTH, SCREEN_HEIGHT / 2 - CARDS.CARD_HEIGHT, CARDS.CARD_WIDTH * 2, CARDS.CARD_HEIGHT * 2);
		drawCard(SCREEN_WIDTH / 2 - CARDS.CARD_WIDTH / 2, SCREEN_HEIGHT / 2 - CARDS.CARD_HEIGHT / 2, card);
	}
	
	public void drawCard(int x, int y, int card)
	{
		cGame_g.setColor(CARDS.CARD_COLOR);
		cGame_g.fillRect(x, y, CARDS.CARD_WIDTH, CARDS.CARD_HEIGHT);
		cGame_g.setColor(CARDS.CARD_TEXT_COLOR);
		cGame_g.drawRect(x, y, CARDS.CARD_WIDTH, CARDS.CARD_HEIGHT);
		#ifndef REMOVE_IMAGES
			#if SCREEN_WIDTH==128
			cGame_g.drawRegion(cardsImg, SPRITES.CARD_MODULE_X[tegCountries[card].cardImage], SPRITES.CARD_MODULE_Y[tegCountries[card].cardImage], SPRITES.CARD_MODULE_W[tegCountries[card].cardImage], SPRITES.CARD_MODULE_H[tegCountries[card].cardImage], 0, x + CARDS.CARD_WIDTH / 2 - SPRITES.CARD_MODULE_W[tegCountries[card].cardImage] / 2, y + CARDS.CARD_HEIGHT / 2 - SPRITES.CARD_MODULE_H[tegCountries[card].cardImage] / 2 - 3, 0);
			#else
			cGame_g.drawRegion(cardsImg, SPRITES.CARD_MODULE_X[tegCountries[card].cardImage], SPRITES.CARD_MODULE_Y[tegCountries[card].cardImage], SPRITES.CARD_MODULE_W[tegCountries[card].cardImage], SPRITES.CARD_MODULE_H[tegCountries[card].cardImage], 0, x + CARDS.CARD_WIDTH / 2 - SPRITES.CARD_MODULE_W[tegCountries[card].cardImage] / 2, y + CARDS.CARD_HEIGHT / 2 - SPRITES.CARD_MODULE_H[tegCountries[card].cardImage] / 2, 0);
			#endif
		#endif
		cGame_g.setFontColor(CARDS.CARD_TEXT_COLOR);
		cGame_g.setFont(DGraph.FONT_SMALL);
		cGame_g.drawString(tegCountries[card].name, x + CARDS.CARD_WIDTH / 2, y + CARDS.CARD_HEIGHT - cGame_g.getFontPixelSize() * 2, DSmallFont.HCENTER | DSmallFont.BOTTOM);
		cGame_g.setFont(DGraph.FONT_BIG);
	}
	
	int[] cardStack;
	
	public void initCards()
	{
		int card = 0;
		boolean cardInStack;
		
		cardStack = new int[COUNTRY_INFO.TOTAL_COUNTRIES];
	
		for(int i = 0; i < COUNTRY_INFO.TOTAL_COUNTRIES; i++)
		{			
			do
			{
				cardInStack = false;
			
				do
				{
					card = random.nextInt() % COUNTRY_INFO.TOTAL_COUNTRIES;
				}
				while(card < 0);
				
				if(i > 0)
				{
					for(int j = i - 1; j >= 0; j--)
					{
						if(card == cardStack[j])
						{
							cardInStack = true;
							break;
						}
					}
				}
			}
			while(cardInStack);
			
			cardStack[i] = card;
		}
	}